package demo.miner;


public class Order {

	public static enum Type {
		STAY, ATTACK, GUARD, MOVE, FOLLOW, DEPLOY
	}

	private Type type;
	private int targetId;
	private int targetX, targetY;

	public Order() {
		
	}
	
	public Order(Type type) {
		this.type = type;
	}
	
	public Type getType() {
		return type;
	}

	public Order setType(Type type) {
		this.type = type;
		return this;
	}

	public int getTargetId() {
		return targetId;
	}

	public Order setTargetId(int targetId) {
		this.targetId = targetId;
		return this;
	}

	
	public Order setTarget(int x , int y) {
		targetX = x;
		targetY = y;
		return this;
	}
	
	public int getTargetX() {
		return targetX;
	}

	public Order setTargetX(int targetX) {
		this.targetX = targetX;
		return this;
	}

	public int getTargetY() {
		return targetY;
	}

	public Order setTargetY(int targetY) {
		this.targetY = targetY;
		return this;
	}
	
	public String toString() {
		return type.toString();// + " : " + targetX + ", " + targetY + " : " + targetId;
	}
	
	public static Order stay() {
		return new Order(Type.STAY);
	}
	
	public static Order move(int x, int y) {
		return new Order(Type.MOVE).setTarget(x, y);
	}
	
	public static Order follow(int id) {
		return new Order(Type.FOLLOW).setTargetId(id);
	}
	
	public static Order guard(int targetId) {
		return new Order(Type.GUARD).setTargetId(targetId);
	}

	public static Order attack(int targetId) {
		return new Order(Type.ATTACK).setTargetId(targetId);
	}

}
